cmake_minimum_required (VERSION 2.6)
project (Speech)

set (RAWDTW rawdtw)
add_executable(${RAWDTW} ${RAWDTW}.cpp)

set (PRO2_MAIN pro2_demo)
add_executable(${PRO2_MAIN} ${PRO2_MAIN}.cpp)

set (PRO3_MAIN pro3_demo)
add_executable(${PRO3_MAIN} ${PRO3_MAIN}.cpp)

set (PRO5_MAIN pro5_demo)
add_executable(${PRO5_MAIN} ${PRO5_MAIN}.cpp)

set (PRO4_MAIN_PART1 pro4_demo_1)
add_executable(${PRO4_MAIN_PART1} ${PRO4_MAIN_PART1}.cpp)

set (HMM_DEMO hmm_demo)
add_executable(${HMM_DEMO} ${HMM_DEMO}.cpp)

set (RECOREDER recorder)
add_executable(${RECOREDER} ${RECOREDER}.cpp)

set (PRO6_MAIN pro6_demo)
add_executable(${PRO6_MAIN} ${PRO6_MAIN}.cpp)

set(ANALYSIS Analysis)
set(CAPTURE Capture)
set(FEATURE Feature)
set(TEST test)
set(CONFIGURE Configure)
set(READWAVE readwave)
set(DATA data)
set(THREADPOOL ThreadPool)
set(EDITDISTANCE EditDistance)
set(LEXTREE LexTree)
set(GRAPH Graph)

ADD_DEFINITIONS(
    -std=c++11
)

include_directories ("${PROJECT_SOURCE_DIR}/${TEST}")
include_directories ("${PROJECT_SOURCE_DIR}/${FEATURE}")
include_directories ("${PROJECT_SOURCE_DIR}/${CAPTURE}")
include_directories ("${PROJECT_SOURCE_DIR}/${ANALYSIS}")
include_directories ("${PROJECT_SOURCE_DIR}/${CONFIGURE}")
include_directories ("${PROJECT_SOURCE_DIR}/${READWAVE}")
include_directories ("${PROJECT_SOURCE_DIR}/${DATA}")
include_directories ("${PROJECT_SOURCE_DIR}/${EDITDISTANCE}")
include_directories ("${PROJECT_SOURCE_DIR}/${THREADPOOL}")
include_directories ("${PROJECT_SOURCE_DIR}/${LEXTREE}")
include_directories ("${PROJECT_SOURCE_DIR}/${GRAPH}")

add_subdirectory (${TEST})
add_subdirectory (${FEATURE})
add_subdirectory (${CAPTURE})
add_subdirectory (${ANALYSIS})
add_subdirectory (${CONFIGURE})
add_subdirectory (${READWAVE})
add_subdirectory (${DATA})
add_subdirectory (${EDITDISTANCE})
add_subdirectory (${THREADPOOL})
add_subdirectory (${LEXTREE})

add_subdirectory (${GRAPH})

target_link_libraries(${PRO2_MAIN} ${FEATURE})
target_link_libraries(${PRO2_MAIN} ${TEST})
target_link_libraries(${PRO2_MAIN} ${CAPTURE})
target_link_libraries(${PRO2_MAIN} ${ANALYSIS})
target_link_libraries(${PRO2_MAIN} ${DATA})
target_link_libraries(${PRO2_MAIN} ${CONFIGURE})
target_link_libraries(${PRO2_MAIN} ${THREADPOOL})
target_link_libraries(${PRO2_MAIN} ${READWAVE})
target_link_libraries(${PRO2_MAIN} portaudio)
target_link_libraries(${PRO2_MAIN} pthread)


target_link_libraries(${PRO3_MAIN} ${EDITDISTANCE})
target_link_libraries(${PRO3_MAIN} ${THREADPOOL})
target_link_libraries(${PRO3_MAIN} ${CONFIGURE})
target_link_libraries(${PRO3_MAIN} pthread)

target_link_libraries(${PRO5_MAIN} ${CONFIGURE})
target_link_libraries(${PRO5_MAIN} ${LEXTREE})
target_link_libraries(${PRO5_MAIN} ${THREADPOOL})
target_link_libraries(${PRO5_MAIN} ${EDITDISTANCE})
target_link_libraries(${PRO5_MAIN} pthread)

target_link_libraries(${RECOREDER} ${CAPTURE})
target_link_libraries(${RECOREDER} ${ANALYSIS})
target_link_libraries(${RECOREDER} ${DATA})
target_link_libraries(${RECOREDER} ${CONFIGURE})
target_link_libraries(${RECOREDER} ${READWAVE})
target_link_libraries(${RECOREDER} portaudio)
target_link_libraries(${RECOREDER} pthread)

target_link_libraries(${PRO4_MAIN_PART1} ${TEST})
target_link_libraries(${PRO4_MAIN_PART1} ${FEATURE})
target_link_libraries(${PRO4_MAIN_PART1} ${CAPTURE})
target_link_libraries(${PRO4_MAIN_PART1} ${ANALYSIS})
target_link_libraries(${PRO4_MAIN_PART1} ${DATA})
target_link_libraries(${PRO4_MAIN_PART1} ${CONFIGURE})
target_link_libraries(${PRO4_MAIN_PART1} ${THREADPOOL})
target_link_libraries(${PRO4_MAIN_PART1} ${READWAVE})
target_link_libraries(${PRO4_MAIN_PART1} portaudio)
target_link_libraries(${PRO4_MAIN_PART1} pthread)

target_link_libraries(${RAWDTW} ${FEATURE})
target_link_libraries(${RAWDTW} ${TEST})
target_link_libraries(${RAWDTW} ${CAPTURE})
target_link_libraries(${RAWDTW} ${ANALYSIS})
target_link_libraries(${RAWDTW} ${DATA})
target_link_libraries(${RAWDTW} ${CONFIGURE})
target_link_libraries(${RAWDTW} ${THREADPOOL})
target_link_libraries(${RAWDTW} ${READWAVE})
target_link_libraries(${RAWDTW} portaudio)
target_link_libraries(${RAWDTW} pthread)

target_link_libraries(${HMM_DEMO} ${TEST})
target_link_libraries(${HMM_DEMO} ${FEATURE})
target_link_libraries(${HMM_DEMO} ${CAPTURE})
target_link_libraries(${HMM_DEMO} ${ANALYSIS})
target_link_libraries(${HMM_DEMO} ${DATA})
target_link_libraries(${HMM_DEMO} ${CONFIGURE})
target_link_libraries(${HMM_DEMO} ${THREADPOOL})
target_link_libraries(${HMM_DEMO} ${READWAVE})
target_link_libraries(${HMM_DEMO} ${GRAPH})
target_link_libraries(${HMM_DEMO} portaudio)
target_link_libraries(${HMM_DEMO} pthread)

target_link_libraries(${PRO6_MAIN} ${TEST})
target_link_libraries(${PRO6_MAIN} ${FEATURE})
target_link_libraries(${PRO6_MAIN} ${CAPTURE})
target_link_libraries(${PRO6_MAIN} ${ANALYSIS})
target_link_libraries(${PRO6_MAIN} ${EDITDISTANCE})
target_link_libraries(${PRO6_MAIN} ${DATA})
target_link_libraries(${PRO6_MAIN} ${CONFIGURE})
target_link_libraries(${PRO6_MAIN} ${THREADPOOL})
target_link_libraries(${PRO6_MAIN} ${READWAVE})
target_link_libraries(${PRO6_MAIN} ${GRAPH})
target_link_libraries(${PRO6_MAIN} portaudio)
target_link_libraries(${PRO6_MAIN} pthread)

file(COPY ${PROJECT_SOURCE_DIR}/rundot.sh DESTINATION ${PROJECT_BINARY_DIR}/)
file(COPY ${PROJECT_SOURCE_DIR}/seqdot.sh DESTINATION ${PROJECT_BINARY_DIR}/)
